package plugin

import (
	"path"
	"runtime"
	"strings"
	"wf-deploy-agent/conf"
)

type BasePlugin struct {
	Name string
}

func (p *BasePlugin) getIdentity() string {
	return p.Name
}

func (p *BasePlugin) getFileName() string {
	identity := p.getIdentity()
	osType := strings.ToLower(runtime.GOOS)

	if osType == "windows" {
		return identity + ".exe"
	}

	return identity
}

func (p *BasePlugin) getFilePath() string {
	filename := p.getFileName()
	return path.Join(conf.GetPluginDir(), filename)
}
